package day7;

import java.util.Scanner;

/**
 * @author oldliu
 * @since 1.0
 */
public class Arr6 {
    public static void main(String[] args) {
        int[] arr = {8, 4, 21, 14, 23, 16, 22, 67, 77, 1, 6};
        System.out.println("倒序输出：");
        for (int i = arr.length - 1; i >= 0; i--) {
            System.out.print(arr[i] + " ");
        }
        System.out.println();
        Scanner scanner = new Scanner(System.in);
        System.out.print("请输入要找的数：");
        int num = scanner.nextInt();
        for (int i = 0; i < arr.length; i++) {
            if (num == arr[i]) {
                System.out.println(num + "在数列中");
                break;
            }
            //到了最后一个，还没有找到，肯定不在
            if(i== arr.length-1){
                System.out.println(num + "不在数列中");
            }
        }
    }
}
